


function keyLogin(){
    if (event.keyCode==13)  //回车键的键值为13
        login(); //调用登录按钮的登录事件
}
$("#btnSubmit").click(login)
function login() {
    var username = $("input[name='username']").val();
    var password = $("input[name='password']").val();
    var rememberMe = $("input[name='rememberme']").is(':checked');
    $.ajax({
        type: "post",
        url:  "/login",
        data: {
            "username": username,
            "password": password,
            "rememberMe": rememberMe
        },
        success: function(r) {
            if (r.code == 0) {
                $.ajax({
                    type: "get",
                    url:  "/loginMark",
                    data: {},
                    success: function(r) {
                        location.href = '/index';
                    }
                });
            } else {
                layer.msg(r.msg);
            }
        }
    });
}
        var flag=$("#flag").val();
        if (window != window.top) {
            window.top.location.href ="/login?flag="+flag;
        }else{
            if(flag=="2"){
                layer.msg("您已被管理员强制下线，具体原因请联系管理员",{time: 5000});
            }else if(flag=="1"){
                layer.msg("您的账号已经在另一处登陆,如若不是本人操作，请尽快修改密码",{time: 5000});
            }
        }



